<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.">
    <title>jQuery-jsonp</title>
    <style>
        #result {
            width: 300px;
            height: 100px;
            border: solid 1px #089;
        }
    </style>
    <link crossorigin="anonymous" href="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/css/bootstrap.min.css"
        rel="stylesheet">
    <script crossorigin="anonymous" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>

<body>
    <button>点击发送 jsonp 请求</button>
    <div id="result"></div>
    <script>
        const BASE_URL = "http://localhost:8000"
        $('button').eq(0).click(function(){
            $.getJSON(BASE_URL+"/jquery-jsonp-server?callback=?",
            function(data){
                $("#result").html(
                    `
                    name: ${data.name}<br>
                    city: ${data.city}
                    `
                )
            })
        })
    </script>
</body>

</html>